#ifndef __MINIUTIL_DATA_FIFOBUF_H__
#define __MINIUTIL_DATA_FIFOBUF_H__

#include <utility>
namespace miniutil { namespace data {
class fifobuf
{
public:	
	fifobuf(int size = 8192);
	~fifobuf();
	
	fifobuf(const fifobuf& other);
	const fifobuf& operator =(const fifobuf& other);
	
	int read(char* pbuf, int len);
	int getwritepos(std::pair<char*, unsigned int>& writepos);
	void more_content(int len);
	bool have_content();
	bool have_space(int minsize = 1);
	int clear_content();
    int set_buffer_size(int newbufsize);
	
	
private:	
	char* mpbuf;
	int buflen;
	std::pair<unsigned int, unsigned int> contentpos;
};

} }
#endif
